// LUOGU_RID: 106063699
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+5;
int n,m,a[N],f[N],c[N];
char ch[10];
void get(int x)
{
if(x*10+7<=10000)
{
f[x*10+7]=1;
get(x*10+7);
}
if(x*10+4<=10000)
{
f[x*10+4]=1;
get(x*10+4);
}
}
void add(int x,int y){
for(;x<=n;x+=x&-x) {
c[x]+=y;
}
}
int ask(int x)
{
int res=0;
for(;x;x-=x&-x) res+=c[x];
return res;
}
int main()
{
scanf("%d%d",&n,&m);
get(0);
for(int i=1;i<=n;i++)
{
scanf("%d",&a[i]);
if(f[a[i]])
{
add(i,1);
}
}
while(m--)
{
scanf("%s",ch); int l,r,val;
if(ch[0]=='c')
{
scanf("%d%d",&l,&r);
printf("%d\n",ask(r)-ask(l-1));
}
else
{
scanf("%d%d%d",&l,&r,&val);
for(int i=l;i<=r;i++)
{
if(f[a[i]]) add(i,-1);
a[i]+=val;
if(f[a[i]]) add(i,1);
}
}
}
return 0;
}
322. Coin Change | 307. Range Sum Query - Mutable |
287. Find the Duplicate Number | 279. Perfect Squares |
275. H-Index II | 274. H-Index |
260. Single Number III | 240. Search a 2D Matrix II |
238. Product of Array Except Self | 229. Majority Element II |
222. Count Complete Tree Nodes | 215. Kth Largest Element in an Array |
198. House Robber | 153. Find Minimum in Rotated Sorted Array |
150. Evaluate Reverse Polish Notation | 144. Binary Tree Preorder Traversal |
137. Single Number II | 130. Surrounded Regions |
129. Sum Root to Leaf Numbers | 120. Triangle |
102. Binary Tree Level Order Traversal | 96. Unique Binary Search Trees |
75. Sort Colors | 74. Search a 2D Matrix |
71. Simplify Path | 62. Unique Paths |
50. Pow(x, n) | 43. Multiply Strings |
34. Find First and Last Position of Element in Sorted Array | 33. Search in Rotated Sorted Array |